package com.typhoon.dao;

import com.typhoon.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class UserDao {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    public List<User> findById(Long id) {
        return this.jdbcTemplate.query("select * from User where id = ? ",BeanPropertyRowMapper.newInstance(User.class),id);
    }

}
